import {saveSettingItem} from "../pages/home/services/settingService";
import {getMemoryDetails, updateHistoryRecord} from "../components/textChatDialog/chatDialogService";

const TAIXU_SYSTEM_API = "http://localhost:5000";
const OLLAMA_MODEL_HOST = "http://localhost:11434";

export default {
    name: "TaiXu-人工智能系统",
    defalut_page_size: 10,
    global_gray: "#9e9e9e1a",

    TAIXU_SYSTEM_API: TAIXU_SYSTEM_API,
    OLLAMA_MODEL_HOST: OLLAMA_MODEL_HOST,

    theme_color: [
        {key: "1", value: "#5adf96", name: "叶兰绿"},
        {key: "2", value: "#f5515f", name: "赤诚红"},
        {key: "3", value: "#9958dc", name: "玉烟紫"},
        {key: "4", value: "#f7889c", name: "芙蕖粉"},
        {key: "5", value: "#304269", name: "露莓黑"},
        {key: "6", value: "#1890ff", name: "经典蓝"},
        {key: "7", value: "#8c1515", name: "波尔多红"},
        {key: "8", value: "#4C2B18", name: "范戴克棕"},
        {key: "9", value: "#002FA7", name: "克莱因蓝"},
        {key: "10", value: "#00A0B0", name: "蒂芙尼蓝"},
        {key: "11", value: "#FF0000", name: "中国红"},
        {key: "12", value: "#990033", name: "勃艮第红"},
        {key: "13", value: "#2E8B57", name: "马尔斯绿"},
        {key: "14", value: "#FF6347", name: "提香红"},
        {key: "15", value: "#F9DC24", name: "申布伦黄"},
        {key: "16", value: "#0F3053", name: "普鲁士蓝"},
    ],

    menu_main: [
        { key: "home", icon: "ri-home-gear-line", name: "Home" },
        { key: "modal", icon: "ri-ai-generate-2", name: "Modal" },
        { key: "rag", icon: "ri-chat-search-line", name: "RAG" },
        { key: "agent", icon: "ri-ai-agent-line", name: "Agent" },
        { key: "taixu", icon: "ri-nft-line", name: "TaiXu" }
    ],

    menu_side: {
        "home": [
            { key: "platform", link: "/platform", icon: "ri-table-line", name: "工作空间" },
            { key: "setting", link: "/setting", icon: "ri-settings-line", name: "设置管理" },
            { key: "user", link: "/user", icon: "ri-user-line", name: "用户管理" }
        ],
        "modal": [
            { key: "llm", link: "/llm", icon: "ri-chat-1-line", name: "聊天空间" },
            { key: "image", link: "/image", icon: "ri-file-text-line", name: "图文检索" },
            { key: "picture", link: "/picture", icon: "ri-image-line", name: "图片生成" },
            { key: "video", link: "/video", icon: "ri-video-chat-line", name: "视频生成" }
        ],
        "rag": [
            { key: "document", link: "/document", icon: "ri-database-2-line", name: "知识管理" },
            { key: "rag_pattern", link: "/retrieval", icon: "ri-apps-line", name: "RAG模式", children: [
                    { key: "retrieval", link: "/retrieval", icon: "ri-file-search-line", name: "文档检索" },
                    { key: "advance", link: "/advance", icon: "ri-search-ai-2-line", name: "智能检索" },
                    { key: "special", link: "/special", icon: "ri-menu-search-line", name: "特殊检索" },
                ]
            },
            { key: "rag_apply", link: "/arxiv", icon: "ri-shield-line", name: "RAG应用", children: [
                    { key: "arxiv", link: "/arxiv", icon: "ri-file-paper-line", name: "Arxiv检索" },
                    { key: "program", link: "/program", icon: "ri-code-box-line", name: "编程检索" },
                ]
            },
        ],
        "agent": [
            { key: "agent_pattern", icon: "ri-handbag-line", name: "Agent模式", children: [
                    { key: "answer", link: "/answer", icon: "ri-questionnaire-line", name: "智能问答" },
                    { key: "agentic", link: "/agentic", icon: "ri-checkbox-multiple-line", name: "多智能体" },
                ]
            },
            { key: "agent_apply", link: "/topic", icon: "ri-tape-line", name: "Agent应用", children: [
                    { key: "topic", link: "/topic", icon: "ri-article-line", name: "主题报告" },
                ]
            },
        ],
        "taixu": [
            { key: "custom", link: "/custom", icon: "ri-ai-generate-2", name: "TaiXu智能" },
            { key: "detail", link: "/detail", icon: "ri-dashboard-line", name: "系统详情" }
        ]
    },

    document_types: [
        { key: "pdf", name: "pdf" },
        { key: "doc", name: "doc" },
        { key: "docx", name: "docx" },
        { key: "xls", name: "xls" },
        { key: "xlsx", name: "xlsx" },
        { key: "ppt", name: "ppt" },
        { key: "pptx", name: "pptx" },
        { key: "txt", name: "txt" },
        { key: "html", name: "html" }
    ],

    rag_patterns: [
        { key: "NativeRAG", name: "原生RAG", disabled: false },
        { key: "MultiQuery", name: "多问题", disabled: false },
        { key: "RAGFusion", name: "检索融合", disabled: false },
        { key: "SubQuestion", name: "子问题", disabled: false },
        { key: "StepBack", name: "降级提问", disabled: false },
        { key: "HYDE", name: "假设提问", disabled: false },
        { key: "RoutingLogic", name: "逻辑路由", disabled: false },
        { key: "RoutingSemantic", name: "语义路由", disabled: false },
        { key: "QueryConstruction", name: "查询重构", disabled: false },
        { key: "MultiRepresentation", name: "多重表示", disabled: false },
        { key: "RAPTOR", name: "层级索引", disabled: false }
    ],

    rag_advances: [
        { key: "Corrective", name: "纠错型", disabled: false },
        { key: "SelfCheck", name: "反思型", disabled: false },
        { key: "Adaptive", name: "自适应型", disabled: false }
    ],

    rag_specials: [
        { key: "Graph", name: "知识图谱", disabled: false },
        { key: "KeyWord", name: "关键字BM25", disabled: false },
        { key: "Hybrid", name: "混合检索", disabled: false },
        { key: "KMean", name: "K均值聚类", disabled: false },
        { key: "MMR", name: "最大边际相关", disabled: false }
    ],

    agent_patterns: [
        { key: "ReAct", name: "推理行动", disabled: false },
        { key: "ReWOO", name: "无观察推理", disabled: false },
        { key: "PlanExecute", name: "规划执行", disabled: false },
        { key: "LLMCompile", name: "LLM编译", disabled: true },
        { key: "Reflection", name: "反思型", disabled: false },
        { key: "SelfDiscover", name: "自发现", disabled: false },
        { key: "Reflexion", name: "反射型", disabled: false },
        { key: "LATS", name: "智能树搜索", disabled: true },
    ],

    agent_advances: [
        { key: "Supervisor", name: "监督型", disabled: false },
        { key: "Collaboration", name: "协作型", disabled: false },
        { key: "Hierarchical", name: "层级型", disabled: false },
    ],

    code_tutorials: [
        { key: "python", name: "Python2", disabled: false },
        { key: "python3", name: "Python3", disabled: false },
        { key: "js", name: "JavaScript", disabled: false },
        { key: "html", name: "HTML", disabled: false },
        { key: "css", name: "CSS", disabled: false },
        { key: "java", name: "Java", disabled: false },
        { key: "sql", name: "SQL", disabled: false },
        { key: "git", name: "Git", disabled: false },
        { key: "linux", name: "Linux", disabled: false },
        { key: "react", name: "React", disabled: false },
        { key: "vue3", name: "Vue3", disabled: false },
        { key: "mysql", name: "MySQL", disabled: false },
        { key: "postgresql", name: "PostgreSQL", disabled: false },
        { key: "regexp", name: "正则表达式", disabled: false },
        { key: "design-pattern", name: "Java设计模式", disabled: false },
        { key: "django", name: "Django", disabled: false },
        { key: "fastapi", name: "FastApi", disabled: false },
        { key: "flask", name: "Flask", disabled: false },
        { key: "data-structures", name: "数据结构与算法", disabled: false },
        { key: "docker", name: "Docker", disabled: false },
    ],

    api: {
        common: {
            getAuthCode: `${TAIXU_SYSTEM_API}/common/code`,
            downloadImage: `${TAIXU_SYSTEM_API}/common/download_image`,
        },
        home: {
            snatchCurrentWeather: `${TAIXU_SYSTEM_API}/home/current_weather`,
            refreshStatistics: `${TAIXU_SYSTEM_API}/home/refresh_statistics`,
            getUserPage: `${TAIXU_SYSTEM_API}/user/page`,
            addSystemUser: `${TAIXU_SYSTEM_API}/user/add`,
            deleteSystemUser: `${TAIXU_SYSTEM_API}/user/delete`,
            updateSystemUser: `${TAIXU_SYSTEM_API}/user/update`,
            selectSystemUser: `${TAIXU_SYSTEM_API}/user/select`,
            ollamaModelList: `${OLLAMA_MODEL_HOST}/v1/models`,
            getSettingList: `${TAIXU_SYSTEM_API}/setting/list`,
            saveSettingItem: `${TAIXU_SYSTEM_API}/setting/save`,
        },
        modal: {
            postChatMessage: `${TAIXU_SYSTEM_API}/llm/chat`,
        },
        rag: {
            retrievalRAG: `${TAIXU_SYSTEM_API}/retrieval/rag`,
            uploadDocument: `${TAIXU_SYSTEM_API}/document/upload`,
            uploadRetrieval: `${TAIXU_SYSTEM_API}/retrieval/upload`,
            getDocumentList: `${TAIXU_SYSTEM_API}/document/list`,
            deleteDocument: `${TAIXU_SYSTEM_API}/document/delete`,
            previewDocument: `${TAIXU_SYSTEM_API}/document/preview`,
            downloadDocument: `${TAIXU_SYSTEM_API}/document/download`,
            addDocumentWebsite: `${TAIXU_SYSTEM_API}/document/website`,
            retrievalAdvance: `${TAIXU_SYSTEM_API}/retrieval/advance`,
            retrievalSpecial: `${TAIXU_SYSTEM_API}/special/rag`,
            retrievalArxiv: `${TAIXU_SYSTEM_API}/arxiv/retrieve`,
            retrievalProgram: `${TAIXU_SYSTEM_API}/program/retrieve`,
        },
        agent: {
            answerAgentMessage: `${TAIXU_SYSTEM_API}/agent/invoke`,
            postMultiAgent: `${TAIXU_SYSTEM_API}/agentic/invoke`,
            postTopicAgent: `${TAIXU_SYSTEM_API}/topic/invoke`,
        },
        memory: {
            getHistoryRecords: `${TAIXU_SYSTEM_API}/history/records`,
            deleteHistoryRecord: `${TAIXU_SYSTEM_API}/history/delete`,
            getMemoryDetails: `${TAIXU_SYSTEM_API}/memory/details`,
            updateHistoryRecord: `${TAIXU_SYSTEM_API}/history/update`,
            downloadMemoryDetails: `${TAIXU_SYSTEM_API}/memory/download`,
        }
    }
}
